<template>
  <div class="ff-regular">
    <Modal v-model="novicePop" width="75" :closable="false" :mask-closable="false" class-name="vertical-center-modal">
      <div slot="header"></div>
      <div class="content-sty">
        <div class="left">
					<div v-if="currentImgUrl != ''" class="lead-div">
						<template v-for="(item,index) in dataArr">
							<img :key="index" :src="item.img" class="lead-img" alt="" v-show="currentIndex == index">
						</template>
					</div>
          <!-- <img v-if="dataArr[currentIndex].img != ''" :src="dataArr[currentIndex].img" class="lead-img" alt=""> -->
          <!-- <div class="zoom-btn">
            <Icon type="ios-resize" class="zoom-icon" />
          </div> -->
          <!-- 包裹重和实际重重量 -->
          <div v-if="currentImgUrl == '' || currentImgUrl == null" class="bg-sty">
            <div class="info-text" v-for="v in textArr" :key="v.id">
              <div class="title ff-bold"><span class="dot-text">·</span> {{ $t(v.title) }}</div>
              <div class="content-text">{{ $t(v.content) }}</div>
            </div>
          </div>
        </div>
        <div class="right">
          <div class="head">
            <div class="pop-title ff-bold">{{ $t(titleData) }}</div>
            <Icon type="md-close" class="close" @click="closeMet()" />
          </div>
          <div :class="currentIndex === index ? 'select-menu' : 'list-menu'" v-for="(item, index) in dataArr"
            :key="index" @click="selectItem(index)">
            <div class="text ff-bold">{{ $t(item.title) }}</div>
          </div>
        </div>
      </div>
      <div slot="footer"></div>
    </Modal>
  </div>
</template>
<script>

export default {
  props: {
    dataArr: {
      type: Array,
      default: () => {
        return []
      }
    },
    titleData: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      novicePop: false,
      currentIndex: 0,  // 默认选中第一条数据的索引
      textArr: [
        { id: 1, title: 'assistant.warehouseWeightTitle1', content: 'assistant.warehouseWeightSub1' },
        { id: 2, title: 'assistant.warehouseWeightTitle2', content: 'assistant.warehouseWeightSub2' },
        { id: 3, title: 'assistant.warehouseWeightTitle3', content: 'assistant.warehouseWeightSub3' }
      ]
    }
  },
  computed: {
    currentImgUrl() {
      return this.dataArr[this.currentIndex].img;
    }
  },
  methods: {
    open() {
      this.novicePop = true;
    },
    closeMet() {
      this.novicePop = false;
    },
    selectItem(index) {
      this.currentIndex = index;
    }
  }
}
</script>

<style lang="less" scoped>
:deep(.ivu-modal-content) {
  border-radius: 12px;
}

:deep(.ivu-modal-header) {
  border: none;
  padding: 0;
  height: 0;
}

:deep(.ivu-modal-body) {
  height: 520px;
  padding: 0;
}

:deep(.ivu-modal-footer) {
  border: none;
  height: 0;
  padding: 0;
}

.vertical-center-modal {
  display: flex;
  align-items: center;
  justify-content: center;

  .content-sty {
    display: flex;

    .left {
      width: 70%;
      height: 520px;
      background: linear-gradient(180deg, #EBF9FF 0%, #D0E6FF 100%);
      border-radius: 12px 0 0 12px;
      padding: 32px 24px;
      position: relative;
			.lead-div{
				width: 100%;
				height: 100%;
			}
      .lead-img {
        width: 100%;
        height: 100%;
				object-fit: contain;
      }

      .zoom-btn {
        width: 22px;
        height: 22px;
        background: rgba(0, 0, 0, 0.49);
        border-radius: 50%;
        text-align: center;
        cursor: pointer;
        position: absolute;
        bottom: 38px;
        right: 30px;

        .zoom-icon {
          color: #FFFFFF;
          line-height: 22px;
        }
      }

      .bg-sty {
        width: 100%;
        height: 100%;
        background-color: #FFFFFF;
        padding: 32px;

        .info-text {
          .title {
            font-weight: 600;
            font-size: 18px;
            color: #1E1714;
            line-height: 21px;
            margin-bottom: 12px;

            .dot-text {
              font-weight: 900;
            }
          }

          .content-text {
            font-weight: 400;
            font-size: 16px;
            color: #AEB0B9;
            line-height: 18px;
            margin-bottom: 24px;
          }
        }
      }
    }

    .right {
      width: 30%;
      padding: 32px 21px 0 16px;

      .head {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 20px;

        .pop-title {
          font-weight: 600;
          font-size: 20px;
          color: #000000;
          line-height: 23px;
        }

        .close {
          color: #1E1714;
          font-size: 36px;
          font-weight: 500;
          cursor: pointer;
        }
      }

      .list-menu {
        min-height: 46px;
        background: #FFFFFF;
        border-radius: 8px 8px 8px 8px;
        border: 1px solid #E4E4E4;
        padding: 12px;
        margin-top: 16px;
        cursor: pointer;

        .text {
          font-weight: 600;
          font-size: 16px;
          color: #333333;
          line-height: 18px;
        }
      }

      .list-menu:hover {
        background: #FFF4F8;
        border: 1px solid #F21473;

        .text {
          color: #F21473;
        }
      }

      .select-menu {
        min-height: 46px;
        background: #FFF4F8;
        border-radius: 8px 8px 8px 8px;
        border: 1px solid #F21473;
        padding: 12px;
        margin-top: 16px;
        cursor: pointer;

        .text {
          font-weight: 600;
          font-size: 16px;
          color: #F21473;
          line-height: 18px;
        }
      }
    }
  }
}
</style>
